package db.pojo;

import java.util.*;
import java.text.SimpleDateFormat;
import db.ext.Ea_demo_uploadExt;
@SuppressWarnings("unchecked")
/**
 * ea_demo_upload
 */
public class Ea_demo_upload {
	/**
	 * fileid
	 */
	public String fileid;
	/**
	 * title
	 */
	public String title;
	/**
	 * path
	 */
	public String path;
	/**
	 * filesize
	 */
	public int filesize;
	/**
	 * remark
	 */
	public String remark;
	SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
	public static Ea_demo_uploadExt DB = new Ea_demo_uploadExt(); 
	
	public Ea_demo_upload() {
		super();
	}
	
	public Ea_demo_upload(String fileid, String title, String path, int filesize, String remark) {
		super();
		this.fileid = fileid; 
		this.title = title; 
		this.path = path; 
		this.filesize = filesize; 
		this.remark = remark; 
	}
	
	public String getFileid() {
		return fileid;
	}

	public void setFileid(String fileid) {
		this.fileid = fileid;
	} 
	
	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	} 
	
	public String getPath() {
		return path;
	}

	public void setPath(String path) {
		this.path = path;
	} 
	
	public int getFilesize() {
		return filesize;
	}

	public void setFilesize(int filesize) {
		this.filesize = filesize;
	} 
	
	public void changeFilesizeWith(int filesize){
		this.filesize += filesize;
	}
	
	public void changeFilesizeWithMin(int filesize,int min){
		this.filesize += filesize;
		this.filesize = this.filesize < min ? min : this.filesize;
	}
	
	public void changeFilesizeWithMax(int filesize,int max){
		this.filesize += filesize;
		this.filesize = this.filesize > max ? max : this.filesize;
	}
	
	public void changeFilesizeWithMaxMin(int filesize,int max,int min){
		this.filesize += filesize;
		this.filesize = this.filesize < min ? min : this.filesize;
		this.filesize = this.filesize > max ? max : this.filesize;
	}	
	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	} 
	
	
	public Map ea_demo_uploadToMap() {
		Map map = new HashMap();
		try {
			map.put("fileid",this.fileid);
			map.put("title",this.title);
			map.put("path",this.path);
			map.put("filesize",this.filesize);
			map.put("remark",this.remark);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return map;
	}

	public Ea_demo_upload mapToEa_demo_upload(Map map){
		try {
			String fileid =  map.get("fileid").toString();
			String title =  map.get("title").toString();
			String path =  map.get("path").toString();
			int filesize = Integer.parseInt( map.get("filesize").toString());
			String remark =  map.get("remark").toString();
			Ea_demo_upload ea_demo_upload = new Ea_demo_upload(fileid, title, path, filesize, remark);
			return ea_demo_upload;
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		}
	} 
	
	public String toString(){
		return ea_demo_uploadToMap().toString();
	}
	
	//方便数据操作	
	public Ea_demo_upload insert(){
		return DB.insert(this);
	}
	public Ea_demo_upload update(){
		return DB.update(this);
	}
	
	public int delete(){
		return DB.delete(this);
	}
	
}
